import React, {useState, useRef, useEffect} from 'react';
import {PageContainer} from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import {getPage, updateApp,del} from './service';
import "./index.css";
import {Button, Input, message, Modal, Select} from "antd";
import Access from "@/components/Access/Access";
import {PlusOutlined} from "@ant-design/icons";
import CreateForm from "./components/CreateForm";
import styles from "@/global.less";

const TableList = (props) => {
  const actionRef = useRef();
  const [count, setCount] = useState();
  const [createModalVisible, handleModalVisible] = useState(false);
  const [formValues, setFormValues] = useState({});
  useEffect(() => {
  }, []);

  const columns = [
    {
      title: '申请人',
      dataIndex: 'user',
    },
    {
      title: '申请状态',
      dataIndex: 'id',
      render: (dom, entity) => {
        return <a>申请通过</a>;
      },
    },
    {
      title: '退款时间',
      dataIndex: 'payDate',
      hideInSearch:true
    },

    {
      title: '退款金额',
      dataIndex: 'money',
      hideInSearch:true
    },
    {
      title: '收款账号',
      dataIndex: 'account',
      hideInSearch:true
    },
    {
      title: '原因',
      dataIndex: 'remake',
      hideInSearch:true
    },
  ];

  return (
    <PageContainer>
      <ProTable
        headerTitle="退货退款列表"
        actionRef={actionRef}
        rowKey="id"
        scroll={{x: 1400}}
        bordered
        request={(params, sorter, filter) => getPage({...params, sorter, filter})}
        postData={(payload) => {
          const {list, total} = payload;
          setCount(total);
          return list || [];
        }}
        toolBarRender={() => [
        ]}
        columns={columns}
        pagination={{
          defaultPageSize: 30,
          showSizeChanger: false,
          showTitle: false,
          total: count,
          showTotal: (total) => `共${total}条`,
        }}
      />

    </PageContainer>
  );
};

export default TableList;
